$(function () {
    var changeClientLog_datagrid = $("#changeClientLog_datagrid");

    changeClientLog_datagrid.datagrid({
        url: "changeClientLog/list",
        fit: true,
        fitColumns: true,
        striped: true,
        singleSelect: true,
        pagination: true,
        rownumbers: true,
        toolbar: '#tb',
        columns: [[
            {field: "ck", checkbox: true},//显示多选框样式
            {field: "changeDate", title: "移交日期", width: 100,sortable: true},
            {
                field: "handleUser", title: "操作人", width: 100, formatter: function (value, row, index) {
                    if (value) {
                        return value.username;
                    } else {
                        return "获取名字操作人失败";
                    }
                }
            },
            {
                field: "clientName", title: "客户", width: 100, formatter: function (value, row, index) {
                    if (value) {
                        return value.name;
                    } else {
                        return "获取客户名字失败";
                    }
                }
            },
            {
                field: "oldUser", title: "移交前负责人", width: 100, formatter: function (value, row, index) {
                if (value) {
                    return value.username;
                } else {
                    return "获取客户名字失败";
                }
            }
            },
            {
                field: "newUser", title: "移交后负责人", width: 100, formatter: function (value, row, index) {
                if (value) {
                    return value.username;
                } else {
                    return "获取客户名字失败";
                }
            }
            },
            {field: "reason", title: "移交原因", width: 100}
        ]],

    });

})
//工具栏的高级查询
function query() {

    /*客户名称*/
    var cbn = $("#clientByName").textbox("getValue");

    /*操作人*/
    var hun = $("#handleUserName").textbox("getValue");

    /*移交前负责人*/
    var oun = $("#oldUserName").textbox("getValue");

    /*移交后负责人*/
    var nun = $("#newUserName").textbox("getValue");

    /*根据创建时间查询*/
    /*开始时间*/
    var bd = $("#beginDate").textbox("getValue");
    /*结束时间*/
    var ed = $("#endDate").textbox("getValue");
    $("#changeClientLog_datagrid").datagrid("load", {
        clientByName: cbn,
        handleUserName: hun,
        oldUserName: oun,
        newUserName: nun,
        beginDate: bd,
        endDate: ed
    });
}
 function reload() {
     $("#changeClientLog_datagrid").datagrid("reload");
}